<?php
set_time_limit(0);
 
$dbhost = '121.199.14.51';
$dbuser = 'root';
$dbpwd  ='sxy7788123456';
$dbName ='linshi';
$mysqliA = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);

$dbhost = 'localhost';
$dbuser = 'root';
$dbpwd  ='sxy7788123456';
$dbName ='dumpling';
$mysqliB = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
$id=0;
if (isset($_GET['id'])){
    $id=$_GET['id'];
}
if (100000 == $id){
    exit;
}
$query=$mysqliA->query("SELECT id,name FROM `juan5` where id>".$id."  limit 0,20 ");
while ($list =$query->fetch_assoc()){
    $sql="INSERT INTO `juan5` (`name`) VALUES ('".$list['name']."');";
    $mysqliB->query($sql);
    $id=$list['id'];
    echo $id,"<br />";
 
}
$mysqliA->close();
$mysqliB->close();
?>
<script>
window.setTimeout(function(){
   window.location.href="?id=<?php echo $id; ?>";
}, 500);
</script>

